﻿using Prism.Commands;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp_PrismRegionBase.ViewModels;

public class MainWindowViewModel
{
    public DelegateCommand<string>? SkipPageBtn { get; set; }

    public DelegateCommand? OpenSubWindow { get; set; }

    public string? TextValue { get; set; }

    public MainWindowViewModel(IRegionManager regionManager,IDialogService dialogService)
    {


        SkipPageBtn = new DelegateCommand<string>(_arg =>
        {
            if (_arg == "ViewB")
            {
                NavigationParameters navParam = new NavigationParameters();
                navParam.Add("username","tom");
                regionManager.RequestNavigate("viewRegion", _arg, navParam);
            }
            else
                regionManager.RequestNavigate("viewRegion", _arg);
        });

        OpenSubWindow = new DelegateCommand(() => 
        {
            dialogService.ShowDialog("DialogUserView");
        });

    }
}
